package deng.qiya.dao;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;

import deng.qiya.model.CrsStRoomType;
import deng.qiya.model.Hotel;
import deng.qiya.util.ResvHelper;
import deng.qiya.wechat.HomeController;


public class HotelOper {
	
	private static final Logger logger = LoggerFactory.getLogger(HotelOper.class);

	
	//checkCodeOper
	
	@Autowired
	private CheckCodeOper checkCodeOper;
	
	@Cacheable("hotels")
	public List<Hotel> getAllHotels(){
		
		logger.info("enter getAllHotels method.");
		List<Hotel> hotels = new ArrayList<Hotel>();
		for(int i =0; i<1; i++){
			Hotel hotel = new Hotel();
			hotel.setHotelId("hotelId"+i);
			hotel.setHotelName("hotelName"+i);
			hotels.add(hotel);
		}
		return hotels;
	}
	
	
	public List<String> getAllRoomType(){
		String rmTypeStr = "YK,B1,B2,B5,B6,B9,C1,C2,C3,DB,DR,F1,F2,FB,FD,HB,HD,HK" +
				",HQ,HS,JT,S1,S2,S3,T1,T2,T3,T5,T6,TB,TD,TF,TH,XY,YA,YB,YC,YD,YE,YG," +
				"YH,YI,YJ,YL,YM,YN,YO,YP,ZZ";
		List<String> list = new ArrayList<String>();
		String[] rmTypeArr = rmTypeStr.split(",");
		for(String str:rmTypeArr){
			list.add(str);
		}
		return list;
	}
	
	public  String getRommTypeDesp(String RmTpCd)
	{
		
		List<CrsStRoomType> lst=checkCodeOper.getCrsStRoomType();
		System.out.println(RmTpCd);
		RmTpCd=RmTpCd.toUpperCase();
		for(CrsStRoomType rm: lst)
		{
			
			if(RmTpCd.equals(rm.getRmTypeCd()))
			{
				
				return rm.getRmTypeDesp();
			}
			
		}
		
		return "";
		
	}
	
	public List<String> getSelectHotelNum(){
		String selectNum = "1,2,3,4,5";
		List<String> list = new ArrayList<String>();
		String[] selectArr = selectNum.split(",");
		for(String str:selectArr){
			list.add(str);
		}
		return list;
	}
	
	
	
	
}
